from pieces import *
from board import *
from chessproblem import *
from games import *


def prueba():
	
	
	
	problemas=[]
	
	'''
	
	"Problema 1"

	
	b=Board()
	
	"Piezas Blancas"	
	b.addWhitePiece(King( (0,1),'K'))
	b.addWhitePiece(Pawn( (2,3),'P'))
	b.addWhitePiece(Pawn( (3,3),'P'))
	b.addWhitePiece(Queen((3,6),'Q'))
	
	"Piezas Negras"	
	b.addBlackPiece(King((1,3),'K'))
	
	
	problemas.append(ChessProblem(b,'W'));
	
	
	"Problema 2"
	
	b=Board()
	
	"Piezas Blancas"	
	b.addWhitePiece(King((2,2),'K'))
	b.addWhitePiece(Bishop((7,0),'B'))
	b.addWhitePiece(Knight((7,2),'N'))
	b.addWhitePiece(Rock((7,4),'R'))
	
	"Piezas Negras"	
	b.addBlackPiece(King((4,2),'K'))
	
	problemas.append(ChessProblem(b,'W'));
	
	"Problema 3"
	
	b=Board()
	
	"Piezas Blancas"	
	b.addWhitePiece(King((5,3),'K'))
	b.addWhitePiece(Pawn((6,3),'P'))
	b.addWhitePiece(Queen((6,1),'Q'))
	b.addWhitePiece(Rock((0,6),'R'))
	
	"Piezas Negras"	
	b.addBlackPiece(King((5,5),'K'))
	b.addBlackPiece(Pawn((3,3),'P'))
	b.addBlackPiece(Queen((3,2),'Q'))

	problemas.append(ChessProblem(b,'W'));


	
	
	"Problema 4"
	
	b=Board()
	
	"Piezas Blancas"	
	b.addWhitePiece(King((7,6),'K'))
	b.addWhitePiece(Pawn((5,3),'P'))
	b.addWhitePiece(Pawn((6,5),'P'))
	b.addWhitePiece(Pawn((5,6),'P'))
	b.addWhitePiece(Queen((5,2),'Q'))
	b.addWhitePiece(Bishop((6,1),'B'))
	
	"Piezas Negras"	
	b.addBlackPiece(King((0,6),'K'))
	b.addBlackPiece(Pawn((1,7),'P'))
	b.addBlackPiece(Pawn((2,6),'P'))
	b.addBlackPiece(Pawn((3,5),'P'))
	b.addBlackPiece(Queen((3,7),'Q'))
	b.addBlackPiece(Bishop((1,1),'B'))

	problemas.append(ChessProblem(b,'W'));
	
	
	
	
	"Problema 5 - Coronacion"
	
	b=Board()
	
	"Piezas Blancas"	
	b.addWhitePiece(King((7,2),'K'))
	b.addWhitePiece(Pawn((1,1),'P'))
	b.addWhitePiece(Pawn((2,5),'P'))
	b.addWhitePiece(Pawn((2,4),'P'))
	b.addWhitePiece(Pawn((6,2),'P'))
	b.addWhitePiece(Queen((6,1),'Q'))
	
	"Piezas Negras"	
	b.addBlackPiece(King((0,5),'K'))
	b.addBlackPiece(Pawn((5,4),'P'))
	b.addBlackPiece(Queen((6,0),'Q'))
	
	problemas.append(ChessProblem(b,'W'));
	
	'''
	
	"Problema 6 - 2 Movs"
	
	b=Board()
	
	"Piezas Blancas"	
	b.addWhitePiece(King((4,7),'K'))
	b.addWhitePiece(Rock((3,3),'R'))
	b.addWhitePiece(Rock((4,5),'R'))
	
	"Piezas Negras"	
	b.addBlackPiece(King((0,2),'K'))
	
	problemas.append(ChessProblem(b,'W',3));
	
	problem=ChessProblem(b,'W',3)
	
	'''
	i=1
	for c in problemas:
		print "Problema ",i
		#minimax_decision(c.initial,c)
		#print alphabeta_full_search(c.initial,c)
		#print alphabeta_search(c.initial,c)
		i+=1
		
	'''
	move=[]	
	
	move.append(alphabeta_search(problem.initial,problem));
		
	problem.initial=problem.result(problem.initial,move[0])
	
	move.append(alphabeta_search(problem.initial,problem));
	
	problem.initial=problem.result(problem.initial,move[1])
	
		
	move.append(alphabeta_search(problem.initial,problem));
	

	
	
	print move[0], move[2]	
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
prueba()
